home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.02 Feb 91 / Menu Bar Sources / HideMenuBarExample.r < prev    next >
Encoding:
Text File  |  1989-10-17  |  3.9 KB  |  235 lines  |  [TEXT/MPS ]

  1. /*
  2. HideMenuBarExample.r
  3. MPW 3.0 Rez source for menu bar hiding example.
  4. Copyright © 1989 D. Grant Leeper.
  5. All rights reserved.
  6. Publication rights granted to MacTutor.
  7. */
  8.  
  9. #include "Types.r"
  10. #include "SysTypes.r"
  11.  
  12. #define kMinSize    24
  13. #define kPrefSize    32
  14.  
  15. #define    rWindow        128
  16. #define    rMenuBar    128
  17. #define    rAboutAlert    128
  18. #define    rFatalAlert    129
  19. #define    rMessages    128
  20.  
  21. #define    mApple        128
  22. #define    mFile        129
  23. #define    mEdit        130
  24.  
  25. resource 'WIND' (rWindow, preload, purgeable) {
  26.     {30, 80, 100, 504},
  27.     zoomDocProc, visible, noGoAway, 0x0,
  28.         "Menu Bar Hiding Example"
  29. };
  30.  
  31. resource 'MBAR' (rMenuBar, preload) {
  32.     { mApple, mFile, mEdit };
  33. };
  34.  
  35. resource 'MENU' (mApple, preload) {
  36.     mApple, textMenuProc,
  37.     0x7FFFFFFF & ~0b10,
  38.     enabled, apple,
  39.     {
  40.         "About HideMenuBarExample…",
  41.             noicon, nokey, nomark, plain;
  42.         "-",
  43.             noicon, nokey, nomark, plain
  44.     }
  45. };
  46.  
  47. resource 'MENU' (mFile, preload) {
  48.     mFile, textMenuProc,
  49.     0b10,
  50.     enabled, "File",
  51.     {
  52.         "Close",
  53.             noicon, "W", nomark, plain;
  54.         "Quit",
  55.             noicon, "Q", nomark, plain
  56.     }
  57. };
  58.  
  59. resource 'MENU' (mEdit, preload) {
  60.     mEdit, textMenuProc,
  61.     0,
  62.     enabled, "Edit",
  63.      {
  64.         "Undo",
  65.             noicon, "Z", nomark, plain;
  66.         "-",
  67.             noicon, nokey, nomark, plain;
  68.         "Cut",
  69.             noicon, "X", nomark, plain;
  70.         "Copy",
  71.             noicon, "C", nomark, plain;
  72.         "Paste",
  73.             noicon, "V", nomark, plain;
  74.         "Clear",
  75.             noicon, nokey, nomark, plain
  76.     }
  77. };
  78.  
  79. resource 'ALRT' (rAboutAlert, purgeable) {
  80.     {60, 40, 184, 340},
  81.     rAboutAlert,
  82.     {    /* array: 4 elements */
  83.         /* [1] */
  84.         OK, visible, silent,
  85.         /* [2] */
  86.         OK, visible, silent,
  87.         /* [3] */
  88.         OK, visible, silent,
  89.         /* [4] */
  90.         OK, visible, silent
  91.     }
  92. };
  93.  
  94. resource 'DITL' (rAboutAlert, purgeable) {
  95.     {    /* array DITLarray: 5 elements */
  96.         /* [1] */
  97.         {92, 110, 112, 190},
  98.         Button {
  99.             enabled,
  100.             "OK"
  101.         },
  102.         /* [2] */
  103.         {4, 78, 20, 222},
  104.         StaticText {
  105.             disabled,
  106.             "HideMenuBarExample"
  107.         },
  108.         /* [3] */
  109.         {24, 37, 40, 262},
  110.         StaticText {
  111.             disabled,
  112.             "Copyright © 1989 D. Grant Leeper."
  113.         },
  114.         /* [4] */
  115.         {44, 86, 60, 214},
  116.         StaticText {
  117.             disabled,
  118.             "All rights reserved."
  119.         },
  120.         /* [5] */
  121.         {64, 19, 80, 281},
  122.         StaticText {
  123.             disabled,
  124.             "Publication rights granted"
  125.             " to MacTutor."
  126.         }
  127.     }
  128. };
  129.  
  130. resource 'ALRT' (rFatalAlert, purgeable) {
  131.     {40, 20, 144, 312},
  132.     rFatalAlert,
  133.     {    /* array: 4 elements */
  134.         /* [1] */
  135.         OK, visible, silent,
  136.         /* [2] */
  137.         OK, visible, silent,
  138.         /* [3] */
  139.         OK, visible, silent,
  140.         /* [4] */
  141.         OK, visible, silent
  142.     }
  143. };
  144.  
  145. resource 'DITL' (rFatalAlert, purgeable) {
  146.     {    /* array DITLarray: 2 elements */
  147.         /* [1] */
  148.         {72, 180, 92, 260},
  149.         Button {
  150.             enabled,
  151.             "OK"
  152.         },
  153.         /* [2] */
  154.         {10, 60, 58, 276},
  155.         StaticText {
  156.             disabled,
  157.             "HideMenuBarExample - An "
  158.             "unexpected error has occurred. "
  159.             "(Probably out of memory.)"
  160.         }
  161.     }
  162. };
  163.  
  164. resource 'STR#' (rMessages, purgeable) {
  165.     {    /* array stringArray: 7 elements */
  166.         /* [1] */
  167.         "Bring application to front to hide "
  168.             "menu bar.",
  169.         /* [2] */
  170.         "Bring window to front to hide menu bar.",
  171.         /* [3] */
  172.         "Bring window to front to show menu bar.",
  173.         /* [4] */
  174.         "Press Command-Space to hide menu bar.",
  175.         /* [5] */
  176.         "Press Command-Space to show menu bar, "
  177.             "or try clicking on the ",
  178.         /* [6] */
  179.         "desktop where a menu title should be, "
  180.             "or try command-clicking ",
  181.         /* [7] */
  182.         "on the desktop where the menu bar "
  183.             "should be."
  184.     }
  185. };
  186.  
  187. /*
  188. We are MultiFinder aware and friendly.
  189. We are probably 32 bit compatible as well but
  190. have not been tested in a 32 bit environment.
  191. */
  192.  
  193. resource 'SIZE' (-1) {
  194.     dontSaveScreen,
  195.     acceptSuspendResumeEvents,
  196.     enableOptionSwitch,
  197.     canBackground,
  198.     multiFinderAware,
  199.     backgroundAndForeground,
  200.     dontGetFrontClicks,
  201.     ignoreChildDiedEvents,
  202.     not32BitCompatible,    /* Not tested */
  203.     reserved,
  204.     reserved,
  205.     reserved,
  206.     reserved,
  207.     reserved,
  208.     reserved,
  209.     reserved,
  210.     kPrefSize * 1024,
  211.     kMinSize * 1024    
  212. };
  213.  
  214. resource 'vers' (1) {
  215.     0x1,
  216.     0x0,
  217.     release,
  218.     0x0,
  219.     verUs,
  220.     "1.0",
  221.     "1.0 © 1989 D. Grant Leeper\n"
  222.     "All rights reserved."
  223. };
  224.  
  225. resource 'vers' (2) {
  226.     0x1,
  227.     0x0,
  228.     release,
  229.     0x0,
  230.     verUs,
  231.     "1.0",
  232.     "Hiding The Menu Bar"
  233. };
  234.  
  235.